import request from "../utils/http";

// 获取供应商列表 GET /supplier
export function getSuppliersList(params) {
  return request({
    url: "/supplier",
    method: "get",
    params: params,
  });
}

// 获取供应商分类列表  GET /supplier/categories
export function getSupplierCategories() {
  return request({
    url: "/supplier/categories",
    method: "get",
  });
}

// 获取单个供应商详情  GET /supplier/:id
export function getSupplierDetail(id) {
  return request({
    url: `/supplier/${id}`,
    method: "get",
  });
}

// 新增供应商  POST /supplier
export function addSupplier(data) {
  return request({
    url: "/supplier",
    method: "post",
    data: data,
  });
}

// 更新供应商信息  PUT /supplier/:id
export function updateSupplier(id, data) {
  return request({
    url: `/supplier/${id}`,
    method: "put",
    data: data,
  });
}

// 停用 (软删除) 供应商 DELETE /supplier/:id
export function deactivateSupplier(id) {
  return request({
    url: `/supplier/${id}`,
    method: "delete",
  });
}
